home *** CD-ROM | disk | FTP | other *** search
Wrap
// Auto Fix utilities // Copyright (c) GTek Technologies Ltd. //======== Plugins are initialized on first call to getObj() method ===================== var g_oDiag = new ADPPlugin("Name=Diag,DllName=OSDiag,FuncName=GetOSDispatch"); var g_oAol = new ADPPlugin("Name=Aol,DllName=AdpAol,FuncName=GetAdpAolDispatch"); var g_oIni = new ADPPlugin("Name=Ini,DllName=Reg,FuncName=GetIniDispatch"); var g_oReg = new ADPPlugin("Name=Reg,DllName=Reg,FuncName=GetRegDispatch"); var g_oSys = new ADPPlugin("Name=Sys,DllName=AdpSys"); var g_oProce = new ADPPlugin("Name=Proce,DllName=Proce,FuncName=GetProcessesDispatch"); var sFlowEvent = ""; var sTriggerType = ""; var bProbedClient = false; //was aol state checked (closed / open / closed / hidden) //======== AF preparation parts ========================================================= function InitADP(oObject) { g_oAdp = oObject; g_hdrStr = "<table cellspacing=0 cellpadding=0 class='AdpHeaderTable'><tr><td><img src='../adpglobal/" + g_oAdp.Vars("sHeaderIcon") + "' ondrag='JavaScript:return false' /></td></tr></table>"; if (g_bCanBeAFCC) { if (g_oIni.getObj().String("AdpData", "trigger", getIniPath()) == "") { // checks "who" was run the AF sTriggerType = g_oAdp.EnvVar("RunGdp_source"); if (sTriggerType == "AOLCoach") { // runs by PSA g_oIni.getObj().String("AdpData", "trigger", getIniPath()) = sTriggerType; } else { sTriggerType = g_oAdp.EnvVar("GTDOWNENV_source"); if (sTriggerType == "WebCyberCoach") { // runs by AOL Web CC g_oIni.getObj().String("AdpData", "trigger", getIniPath()) = sTriggerType; g_oAdp.Vars("RunAFCC") = "TRUE"; } else { g_oIni.getObj().String("AdpData", "trigger", getIniPath()) = "non"; g_oAdp.Vars("RunAFCC") = "FALSE"; } } } } else { g_oAdp.Vars("RunAFCC") = "FALSE"; } if (g_oAdp.Vars("RunReboot") != "Reboot") { g_oAdp.Vars("RunReboot") = g_oIni.getObj().String("AdpData", "result", getIniPath()); g_oAdp.Vars("nBootStepIndex") = g_oIni.getObj().String("AdpData", "step_index", getIniPath()); } adjustGUI(); if (g_oAdp.Vars("RunLangFlow") == "TRUE") { if ((g_oAdp.Vars("RunReboot") == "Reboot") && (g_oAdp.Vars("CurrentADP") != "goEndAF")) { // AF after reboot g_oAdp.ADPID = g_sADPID; g_oAdp.HasCloseButton = true; setVisualStatus(true, true); goFlow(); } else { runAF(); } } else { g_oAdp.Vars("RunLangFlow") = "TRUE"; if (g_oAdp.Vars("RunReboot") == "Reboot") // AF after reboot setUS_EU("main.htm", "main_eu.htm"); else setUS_EU("start.htm", "start_eu.htm"); } } function getLangPSA() { sCmnAppDtPath = "Software\\Microsoft\\Windows\\CurrentVersion\\explorer\\Shell Folders"; sCmnAppDtPath = g_oReg.getObj().String("Current", sCmnAppDtPath, "AppData"); sCfgPath = sCmnAppDtPath + "\\GTek\\GTUpdate\\AUpdate\\AOLCC\\AUCommon.cfg"; sCurrentLang = g_oIni.getObj().String("Channels", "Language", sCfgPath); if (sCurrentLang == "Spanish") { g_oAdp.Vars("StartHtm") = "start_eu.htm"; g_oAdp.Vars("sHeaderIcon") = "bg_icon_eu.gif"; return "eu"; } else { return "us"; } } function setUS_EU(sHtmPageUS, sHtmPageEU) { g_oAdp.Vars("StartHtm") = "start.htm"; if (g_oAdp.Vars("sHeaderIcon") == "") g_oAdp.Vars("sHeaderIcon") = "bg_icon_" + getLangID("sign").substring(0,2) + ".gif"; if ((g_bCanBeAFCC) && (g_oIni.getObj().String("AdpData", "trigger", getIniPath()) == "AOLCoach")) { // runs by PSA if (getLangPSA() == "us") window.location.replace(sHtmPageUS); else window.location.replace(sHtmPageEU); return; } if (g_bRunUS_EU) { var sAolBuild = g_oAol.getObj().AolMajor; if (sAolBuild >= "4148") { var sAolLang = g_oAol.getObj().AolLanguage; if (sAolLang.match(/0|us/i)) { window.location.replace(sHtmPageUS); } else { // "eu" g_oAdp.Vars("StartHtm") = "start_eu.htm"; g_oAdp.Vars("sHeaderIcon") = "bg_icon_eu.gif"; window.location.replace(sHtmPageEU); } } else { window.location.replace(sHtmPageUS); } } else { window.location.replace(sHtmPageUS); } return; } function setFirstStepVisStatus() { if (g_oAdp.Vars("FirstFlowStepRun") != "TRUE") { g_oAdp.Vars("FirstFlowStepRun") = "TRUE"; setVisualStatus(g_bFirstStepVisible, true); } } function runAF() { if ((g_oAdp.Vars("RunIntro") == "TRUE") || (g_oAdp.Vars("RunReboot") == "Reboot")) { setFirstStepVisStatus(); if (g_oAdp.Vars("CurrentADP") == "goEndAF") goEndAF(); else goFlow(); } else { g_oAdp.Vars("currentStep") = 0; // sets First Flow Step g_oAdp.Vars("RunIntro") = "TRUE"; g_oAdp.ADPID = g_sADPID; g_oAdp.HasCloseButton = true; if (!isLangSupported()) { msgElement = document.getElementById("idNotLangSupport" + (getLangID("sign").substring(0,2)).toUpperCase()); setVisualStatus(true, true); showScreen(msgElement, {idBtnClose: closeAdp}); return; } if (checkEnvironment() && checkScreenRes() && checkAcsVer() && preCondition_Extra()) goIntro(); } } function checkEnvironment() { var sOS = g_oDiag.getObj().GetOSString(); if (g_bWin2kOnly) { // shows message if operating system is not supported if (!sOS.match(/Win2000|WinXP/i)) { goExitAF("idNotOS"); return false; } } else { if (!sOS.match(/Win98|Win98SE|WinME|Win2000|WinXP/i)) { goExitAF("idNotOS"); return false; } } if(isScreenReader()) { goExitAF("idReaderEnabled"); return false; } if (sOS.match(/Win2000|WinXP/i)) { // shows message if user has no administrative rights var bAdmin = g_oDiag.getObj().IsAdmin(); if (!bAdmin) { goExitAF("idNotAdmin"); return false; } } if (g_sAolVer != "FALSE") { // shows message if no required AOL version installed if (g_sAolVer.length > 3) // AOL Major build ver. like AOL 9: "4124.10036" sAolVersion = g_oAol.getObj().AolMajor; else // AOL ver. like AOL 6, AOL 7 ... sAolVersion = g_oAol.getObj().Version; if (sAolVersion != g_sAolVer) { goExitAF("idNotAol"); return false; } } return true; } function isScreenReader() { g_oProce.getObj().Refresh; // loop through the process list for (a=0; a<g_oProce.getObj().Count; a++) { sCurrentProcess = g_oProce.getObj().Process(a); if (sCurrentProcess.LongBaseName().toLowerCase().match(/jfw.exe|wineyes.exe|narrator.exe/i)) // is screen reader process return true; } return false; } function checkScreenRes() { if (g_bScreenRes) { if ((screen.width < 800) || (screen.height < 600)) { // minimum resolution is 800X600 goExitAF("idNotScreenRes"); return false; } if (screen.colorDepth < 16) { // minimum color depth is 16 bit goExitAF("idNotScreenRes"); return false; } } return true; } function checkAcsVer() { if (g_nAcsVer != false) { if (g_oReg.getObj().IsRegValue("Local", "Software\\America Online\\Acs", "VersionMajor")) { if (g_oReg.getObj().Long("Local","Software\\America Online\\Acs","VersionMajor") >= g_nAcsVer) { return true; } else { goExitAF("idNotAOL"); return false; } } else { goExitAF("idNotAOL"); return false; } } return true; } function setVisualStatus(bVisible, bTopMost) { if (bVisible) g_oAdp.Visible = true; else g_oAdp.Visible = false; if (bTopMost) g_oAdp.TopMost = true; else g_oAdp.TopMost = false; } function getIniPath() { return g_oAdp.ChangeString(g_sCoachOSAppData) + "\\AdpData.acd"; } function completeFix() { g_oIni.getObj().String("AdpData", "stage", getIniPath()) = ""; g_oIni.getObj().String("AdpData", "result", getIniPath()) = ""; g_oIni.getObj().String("AdpData", "current", getIniPath()) = ""; g_oIni.getObj().String("AdpData", "trigger", getIniPath()) = ""; g_oIni.getObj().String("AdpData", "error_data", getIniPath()) = ""; g_oIni.getObj().String("AdpData", "step_index", getIniPath()) = ""; sPath = g_oAdp.ChangeString("%startup%") + "\\" + g_sADPID + g_sExtension + ".lnk"; bRes = g_oAol.getObj().CopyFile(sPath,"DELETE FILE",false); } function restartFix() { g_oAdp.Vars("FirstFlowStepRun") = "FALSE"; if (document.location.href.indexOf("start") > 0) { // "start.htm" or "start_eu.htm" exists in the path goIntro(); } else { g_oAdp.Vars("RunIntro") = "FALSE"; window.location.replace(g_oAdp.Vars("StartHtm")); } } function goExitAF(sScreenID) { sTriggerType = g_oIni.getObj().String("AdpData", "trigger", getIniPath()); if (g_oAdp.Vars("RunAFCC") == "TRUE") { // Computer CheckUp or PSA (after reboot) AFs sActiveSpan = document.getElementById("idMsgRecheck"); sCmdShow = "showScreen(idRecheck, {idBtnRecheck: goRecheck, idBtnClose: closeAdp})"; } else { sActiveSpan = document.getElementById("idMsgFixed"); sCmdShow = "showScreen(idFixed, {idBtnClose: closeAdp})"; } sActiveSpan.innerHTML = getDsoMsg(sScreenID); completeFix(); setVisualStatus(true, true); eval(sCmdShow); return; } function getDsoMsg(msgId) { if (isCurrentEU()) dsoPath = formatFilePath(document.location.pathname, "afdata_eu.dso"); else dsoPath = formatFilePath(document.location.pathname, "afdata.dso"); dsoPath = dsoPath.replace(/%20/g," "); dsoPath = g_oAdp.LongPathToShort(dsoPath); return g_oIni.getObj().String("dso_data", msgId, dsoPath); } function chkExitWay() { if (g_oAdp.Vars("RunAFCC") == "TRUE") { // Computer CheckUp AFs goEndAF(); } else { completeFix(); closeAdp(); } } function goIntro(bSysTray) { goCheckCloseAOL_Extra(); if (g_bRunIntro) { if (bProbedClient) { g_oAdp.Vars("CurrentADP") = "goIntro"; setVisualStatus(true, true); if (isBrowserOpen() && !bSysTray) showScreen(idIntroAol, {idBtnCancel: chkExitWay, idBtnContinue: goCheckCloseAOL}); else showScreen(idIntro, {idBtnCancel: chkExitWay, idBtnContinue: goCheckCloseAOL}); } else { probeAolClient(); return; } } else { goCheckCloseAOL(); } } function goCheckCloseAOL() { sendStat("Start"); if (g_bRunCloseAOL) initCloseAOL(); else navigateFlow(); } function navigateFlow() { setUS_EU("main.htm", "main_eu.htm"); } function isBrowserOpen(){ if (g_bRunCloseAOL && (g_oAol.getObj().IsAolBrowserOpen() || g_oSys.getObj().FindChildWindow("AOL Frame25","*"))) return true; else return false; } function probeAolClient() { bProbedClient = true; if (g_bRunCloseAOL) { //switch to init screen dispUtil.setMsg("idCloseAOLWait3"); setVisualStatus(true, true); document.all.ProgressBarContainer.style.top = "180"; showScreen(idCloseAOLWait, {idBtnClose: dispUtil.goAbortRetry}); if (!bAbortedClose) idCloseAOLWait.all.idBtnClose.style.display = "none"; g_oSys.getObj().WaitForChildWindowCloseOrUnVisible("AOL_INTRO","_AOL_Toolbar","",1000); } else { goIntro(false); } } function isCurrentEU() { if (g_oAdp.Vars("StartHtm").match(/eu/i) != null) return true; else return false; } function sendStat(sStatID) { if (sStatID == "Start") g_oAdp.Vars("StatWasSent") = "FALSE"; if (g_oAdp.Vars("StatWasSent") != "TRUE") { // == "FALSE" protection after Reboot if (sStatID != "Start") sErrorDesc = ',"Extra=' + g_oIni.getObj().String("AdpData", "error_data", getIniPath()) + '"'; else sErrorDesc = ""; if (sStatID == "End") g_oAdp.Vars("ReturnCodeFixed") = "TRUE"; // g_oAdp.ReturnCode = 0; bStatWasSent = g_oAol.getObj().NotifyServer(g_sADPstatID, sStatID, sErrorDesc); if (sStatID != "Start") g_oAdp.Vars("StatWasSent") = "TRUE"; } } function formatFilePath(sPath, sCurrentFile) { // gets physical File path (customized for URL string) pStart = sPath.indexOf("/") + 1; pEnd = sPath.lastIndexOf("\\"); sFormatPath = sPath.substring(pStart, pEnd); return sFormatPath + "\\" + sCurrentFile; } function prepShutDown(nStepAfterBoot) { if (g_oAdp.MyName.indexOf("aolshare\\coach-Local\\" + g_sADPID + g_sExtension) < 0) { afPath = g_oAdp.ChangeString("%currentappdir%\\") + "local\\" + g_sADPID + g_sExtension; g_oAol.getObj().CopyFile(g_oAdp.MyName ,afPath ,false); } if (nStepAfterBoot > 0) g_oIni.getObj().String("AdpData", "step_index", getIniPath()) = nStepAfterBoot.toString(); g_oIni.getObj().String("AdpData", "current", getIniPath()) = g_sADPID + g_sExtension; } function parseKey(str,key) { // returns "str" part starting from "key" and ending by first "&" OR // returns "" if "key" is not found in "str" OR // returns "str" part starting from "key" and ending by the end of "str" if no "&" in the "str" if (str.indexOf(key) < 0) return(''); if (str.substring(str.indexOf(key)).indexOf('&') > -1) return(str.substring(str.indexOf(key)+key.length,str.substring(str.indexOf(key)).indexOf('&')+str.indexOf(key))); else return(str.substring(str.indexOf(key)+key.length)); } function getLangID(type) { // types can be set to sign / index sLangIndex = g_oAol.getObj().OsLanguage.toString(); sLangName = g_oIni.getObj().String("OsLanguage", sLangIndex, g_oAdp.LongPathToShort(g_oAdp.ChangeString("%currentappdir%") + "\\player\\language\\Language.src")); if (type == "index") return ((sLangIndex == "")? "9-NS" : sLangIndex); // -NS means not supported (by default us) else return ((sLangName == "")? "us-NS" : sLangName); } function getAcpLang() { sAcpDir = g_oAdp.ChangeString("%currentappdir%"); sAcpLang = sAcpDir.substring(sAcpDir.lastIndexOf("\\") + 1, sAcpDir.length); sAcpLang = sAcpLang.substring(sAcpLang.indexOf("_") + 1, sAcpLang.length); return sAcpLang; } function isLangSupported() { sAcpLang = getAcpLang(); sOsLang = getLangID("sign"); var langMatch = new Array(4); langMatch[0] = "10,en,us"; langMatch[1] = "13,en,us"; langMatch[2] = "14,uk,us"; langMatch[3] = "15,fr,fr"; langMatch[4] = "16,de,de"; currSettings = g_sLangID + "," + sAcpLang + "," + sOsLang; for (l=0;l<langMatch.length;l++) { if (langMatch[l].toLowerCase() == currSettings.toLowerCase()) return true; } return false; } function goRecheckPSA() { sRegPSA = "Software\\GTek\\GTUpdate\\AOLCC"; sCfgPath = g_oReg.getObj().String("Local", sRegPSA, "CfgPath"); sCmdLineCenter = g_oIni.getObj().String("General", "CmdLineCenter", sCfgPath); sACCBrwsPath = sCfgPath.substring(0, sCfgPath.lastIndexOf("\\")); sCmdLineCenter = sCmdLineCenter.substring(sCmdLineCenter.lastIndexOf(" "), sCmdLineCenter.length); bResLaunch = g_oAdp.Launch(sACCBrwsPath+"\\ACCBrws.exe", sCmdLineCenter, sACCBrwsPath, -2); } function launchWAOL(sCmdLine) { if (arguments.length == 0) // allows send launchWAOL(); => without argument sCmdLine = ""; sPath = g_oAdp.ChangeString("%windows%") + "\\Win.ini"; sAOL = g_oIni.getObj().String("WAOL", "AppPath", sPath); sExeAOL = g_oAdp.LongPathToShort(sAOL) + "\\waol.exe"; g_oAdp.Launch(sExeAOL, sCmdLine, sAOL, -2); } function goRecheckCC() { sURL = '-u"' + 'aol://4344:2452.CC_URL2.26186256.728938064' + '/"'; launchWAOL(sURL); } function goRecheck() { if (sTriggerType == "AOLCoach") // AF was run by PSA goRecheckPSA(); else goRecheckCC(); closeAdp(); } function goEndAF() { if (g_oAdp.Vars("CurrentADP") != "goEndAF") { g_oAdp.Vars("CurrentADP") = "goEndAF"; window.location.replace(g_oAdp.Vars("StartHtm")); } else { sFlowEvent = parseKey(location.search,"msgId="); // checks for flow message cmd. if (sFlowEvent != "") { goExitAF(sFlowEvent); return; } if (((g_bCanBeAFCC) && (g_oIni.getObj().String("AdpData", "trigger", getIniPath()) == "AOLCoach") && (g_oAdp.Vars("RunReboot") == "Reboot")) || ((g_oIni.getObj().String("AdpData", "trigger", getIniPath()) == "WebCyberCoach") && (g_bCanBeAFCC))) { // AF was run by PSA or CC g_oAdp.Vars("RunAFCC") = "TRUE"; // PSA => like CC AFs - will includes the "Recheck" button goExitAF("idRecheck"); return; } completeFix(); setVisualStatus(true, true); if (g_oAdp.Vars("RunAFCC") == "TRUE") // Computer CheckUp AFs showScreen(idRecheck, {idBtnRecheck: goRecheck, idBtnClose: closeAdp}); else showScreen(idFixed, {idBtnClose: closeAdp}); } } function preCondition_Extra() { // Term to run / exit AF on start; return true = run, return false = exit try { bRes = eval(g_sPreCond); return bRes; } catch(e) { // alert(e.description); // for debugging return true; } } function goCheckCloseAOL_Extra() { // Simple execution, no return code required try { eval(g_sPreCondAOL); } catch(e) { // alert(e.description); // for debugging } }